redid the filesel test. Added a way to set select multiple as a toggle
authorManish Singh <yosh@gimp.org>
Sun, 17 Feb 2002 01:16:24 +0000 (01:16 +0000)
committerManish Singh <yosh@src.gnome.org>
Sun, 17 Feb 2002 01:16:24 +0000 (01:16 +0000)
2002-02-16  Manish Singh  <yosh@gimp.org>

        * tests/testgtk.c: redid the filesel test. Added a way to set select
        multiple as a toggle button, and made show/hide fileops toggle
        buttons as well. get_selections() is called on OK and all the
        filenames selected are printed.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
tests/testgtk.c

index e18ebae9db10ca237b77f1901523fa22b49c7171..36d665706ad2370940968547f273acf176da8cd0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-02-16  Manish Singh  <yosh@gimp.org>
+
+       * tests/testgtk.c: redid the filesel test. Added a way to set select
+       multiple as a toggle button, and made show/hide fileops toggle
+       buttons as well. get_selections() is called on OK and all the
+       filenames selected are printed.
+
 2002-02-17  Tor Lillqvist  <tml@iki.fi>
 
        * README.win32: Remove comment about the gtk-1-3-win32-production
index e18ebae9db10ca237b77f1901523fa22b49c7171..36d665706ad2370940968547f273acf176da8cd0 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-16  Manish Singh  <yosh@gimp.org>
+
+       * tests/testgtk.c: redid the filesel test. Added a way to set select
+       multiple as a toggle button, and made show/hide fileops toggle
+       buttons as well. get_selections() is called on OK and all the
+       filenames selected are printed.
+
 2002-02-17  Tor Lillqvist  <tml@iki.fi>
 
        * README.win32: Remove comment about the gtk-1-3-win32-production
index e18ebae9db10ca237b77f1901523fa22b49c7171..36d665706ad2370940968547f273acf176da8cd0 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-16  Manish Singh  <yosh@gimp.org>
+
+       * tests/testgtk.c: redid the filesel test. Added a way to set select
+       multiple as a toggle button, and made show/hide fileops toggle
+       buttons as well. get_selections() is called on OK and all the
+       filenames selected are printed.
+
 2002-02-17  Tor Lillqvist  <tml@iki.fi>
 
        * README.win32: Remove comment about the gtk-1-3-win32-production
index e18ebae9db10ca237b77f1901523fa22b49c7171..36d665706ad2370940968547f273acf176da8cd0 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-16  Manish Singh  <yosh@gimp.org>
+
+       * tests/testgtk.c: redid the filesel test. Added a way to set select
+       multiple as a toggle button, and made show/hide fileops toggle
+       buttons as well. get_selections() is called on OK and all the
+       filenames selected are printed.
+
 2002-02-17  Tor Lillqvist  <tml@iki.fi>
 
        * README.win32: Remove comment about the gtk-1-3-win32-production
index e18ebae9db10ca237b77f1901523fa22b49c7171..36d665706ad2370940968547f273acf176da8cd0 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-16  Manish Singh  <yosh@gimp.org>
+
+       * tests/testgtk.c: redid the filesel test. Added a way to set select
+       multiple as a toggle button, and made show/hide fileops toggle
+       buttons as well. get_selections() is called on OK and all the
+       filenames selected are printed.
+
 2002-02-17  Tor Lillqvist  <tml@iki.fi>
 
        * README.win32: Remove comment about the gtk-1-3-win32-production
index e18ebae9db10ca237b77f1901523fa22b49c7171..36d665706ad2370940968547f273acf176da8cd0 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-16  Manish Singh  <yosh@gimp.org>
+
+       * tests/testgtk.c: redid the filesel test. Added a way to set select
+       multiple as a toggle button, and made show/hide fileops toggle
+       buttons as well. get_selections() is called on OK and all the
+       filenames selected are printed.
+
 2002-02-17  Tor Lillqvist  <tml@iki.fi>
 
        * README.win32: Remove comment about the gtk-1-3-win32-production
index e18ebae9db10ca237b77f1901523fa22b49c7171..36d665706ad2370940968547f273acf176da8cd0 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-16  Manish Singh  <yosh@gimp.org>
+
+       * tests/testgtk.c: redid the filesel test. Added a way to set select
+       multiple as a toggle button, and made show/hide fileops toggle
+       buttons as well. get_selections() is called on OK and all the
+       filenames selected are printed.
+
 2002-02-17  Tor Lillqvist  <tml@iki.fi>
 
        * README.win32: Remove comment about the gtk-1-3-win32-production
index c0f1da52c443611d1242b0c4456ea16ab01bdf4b..87524256ac8e1de8b5bf0497899d81b604911532 100644 (file)
@@ -6467,17 +6467,42 @@ create_color_selection (void)
  */
 
 void
-file_selection_hide_fileops (GtkWidget *widget,
-                            GtkFileSelection *fs)
+show_fileops (GtkWidget        *widget,
+             GtkFileSelection *fs)
 {
-  gtk_file_selection_hide_fileop_buttons (fs);
+  gboolean show_ops;
+
+  show_ops = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+
+  if (show_ops)
+    gtk_file_selection_show_fileop_buttons (fs);
+  else
+    gtk_file_selection_hide_fileop_buttons (fs);
 }
 
 void
-file_selection_ok (GtkWidget        *w,
-                  GtkFileSelection *fs)
+select_multiple (GtkWidget        *widget,
+                GtkFileSelection *fs)
 {
-  g_print ("%s\n", gtk_file_selection_get_filename (fs));
+  gboolean select_multiple;
+
+  select_multiple = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+  gtk_file_selection_set_select_multiple (fs, select_multiple);
+}
+
+void
+file_selection_ok (GtkFileSelection *fs)
+{
+  int i;
+  gchar **selections;
+
+  selections = gtk_file_selection_get_selections (fs);
+
+  for (i = 0; selections[i] != NULL; i++)
+    g_print ("%s\n", selections[i]);
+
+  g_strfreev (selections);
+
   gtk_widget_destroy (GTK_WIDGET (fs));
 }
 
@@ -6495,29 +6520,31 @@ create_file_selection (void)
 
       gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
 
-      gtk_signal_connect (GTK_OBJECT (window), "destroy",
-                         GTK_SIGNAL_FUNC(gtk_widget_destroyed),
-                         &window);
+      g_signal_connect (window, "destroy",
+                       G_CALLBACK (gtk_widget_destroyed),
+                       &window);
 
-      gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (window)->ok_button),
-                         "clicked", GTK_SIGNAL_FUNC(file_selection_ok),
-                         window);
-      gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (window)->cancel_button),
-                                "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy),
-                                GTK_OBJECT (window));
-      
-      button = gtk_button_new_with_label ("Hide Fileops");
-      gtk_signal_connect (GTK_OBJECT (button), "clicked",
-                         (GtkSignalFunc) file_selection_hide_fileops, 
-                         (gpointer) window);
+      g_signal_connect_swapped (GTK_FILE_SELECTION (window)->ok_button,
+                               "clicked",
+                               G_CALLBACK (file_selection_ok),
+                               window);
+      g_signal_connect_swapped (GTK_FILE_SELECTION (window)->cancel_button,
+                               "clicked",
+                               G_CALLBACK (gtk_widget_destroy),
+                               window);
+      
+      button = gtk_toggle_button_new_with_label ("Show Fileops");
+      g_signal_connect (button, "toggled",
+                       G_CALLBACK (show_fileops),
+                       window);
       gtk_box_pack_start (GTK_BOX (GTK_FILE_SELECTION (window)->action_area), 
                          button, FALSE, FALSE, 0);
       gtk_widget_show (button);
 
-      button = gtk_button_new_with_label ("Show Fileops");
-      gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
-                                (GtkSignalFunc) gtk_file_selection_show_fileop_buttons, 
-                                (gpointer) window);
+      button = gtk_toggle_button_new_with_label ("Select Multiple");
+      g_signal_connect (button, "clicked",
+                       G_CALLBACK (select_multiple),
+                       window);
       gtk_box_pack_start (GTK_BOX (GTK_FILE_SELECTION (window)->action_area), 
                          button, FALSE, FALSE, 0);
       gtk_widget_show (button);